Skip to content

Refactor 41757 for MS functions#8476

Open
SirLouen wants to merge 2 commits intoWordPress:trunkfrom
SirLouen:41757-patch
Open

Refactor 41757 for MS functions#8476
SirLouen wants to merge 2 commits intoWordPress:trunkfrom
SirLouen:41757-patch

Conversation

@SirLouen
Copy link
Copy Markdown
Member

@SirLouen SirLouen commented Mar 8, 2025

Trac ticket: https://core.trac.wordpress.org/ticket/41757

Given that the original patch was posted 8 years ago some little modifications have occurred in the function hence the patch is not working anymore. Here is an updated PR with the updated patch with the same contents.

Props to /johnjamesjacoby /jeremyfelt and /danieltj

More info in the Trac report.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 8, 2025

Hi @SirLouen! 👋

Thank you for your contribution to WordPress! 💖

It looks like this is your first pull request to wordpress-develop. Here are a few things to be aware of that may help you out!

No one monitors this repository for new pull requests. Pull requests must be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description.

Pull requests are never merged on GitHub. The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making.

More information about how GitHub pull requests can be used to contribute to WordPress can be found in the Core Handbook.

Please include automated tests. Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the Automated Testing page in the handbook.

If you have not had a chance, please review the Contribute with Code page in the WordPress Core Handbook.

The Developer Hub also documents the various coding standards that are followed:

Thank you,
The WordPress Project

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 8, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props sirlouen, peterwilsoncc.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 8, 2025

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Copy link
Copy Markdown
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a few notes inline.

Comment on lines +2305 to +2307
* @param int $user_id
* @param mixed $password Accessible via 'added_new_user_to_blog' hook.
* @param array $meta
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Descriptions for user_id and meta will need to be retained, password is still a string.

/**
* Fires when a new user is added to a network site without an error from $result.
*
* @since 4.9.0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @since 4.9.0
* @since 6.9.0

* @param array $meta Array of meta data from the new registration.
* @param int $blog_id Blog ID.
*/
do_action( 'added_new_user_to_blog', $user_id, $password, $meta, $blog_id );
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming things: I'd go with the following as I think it a better practice to use the wp_ prefix followed by the name of the function. I care more about the prefix that changing added to add.

Suggested change
do_action( 'added_new_user_to_blog', $user_id, $password, $meta, $blog_id );
do_action( 'wp_add_new_user_to_blog', $user_id, $password, $meta, $blog_id );

update_user_meta( $user_id, 'primary_blog', $blog_id );

/**
* Fires when a new user is added to a network site without an error from $result.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Fires when a new user is added to a network site without an error from $result.
* Fires when a new user is successfully added to a network site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants